from multiprocessing import Process, Value, Array

def f(n, a):
    n.value = 3.1415927
    for i in range(len(a)):
        a[i] = -a[i]

if __name__ == '__main__':
    # 创建一个共享的整数和数组
    n = Value('d', 0.0)
    a = Array('i', range(5))

    # 启动进程
    p = Process(target=f, args=(n, a))
    p.start()
    p.join()

    print(n.value)
    print(a[:])